fix: stabilize command palette search results#2052
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
…ngs, locations, and team members - Add parallel database queries for comprehensive search across all entity types - Implement permission-aware search with role-based access control - Create distinct UI components with icons and metadata for each result type - Add comprehensive test coverage (10 tests) for all search helper functions - Optimize performance with smart result limits and parallel execution - Update placeholder and help text to reflect expanded search capabilities Search capabilities now include: - Assets: 8 results (BASE+ access) - Kits: 6 results (CURATOR+ access) - Bookings: 6 results (BASE+ access) - Locations: 6 results (CURATOR+ access) - Team Members: 8 results (ADMIN+ access) Performance optimizations: - Parallel Promise.all() execution for all queries - Permission-gated queries to reduce unnecessary database load - Proper result limits to maintain responsive UX - Leverage existing database indexes for optimal query performance
- Add useCommandPaletteSafe hook that doesn't throw when provider is missing - Update CommandPaletteButton to return null when provider is unavailable - Prevents crashes on routes outside _layout+/* that don't have CommandPaletteProvider - Resolves issue where QR linking routes and other non-layout routes would crash This ensures the header can be safely used across all routes without requiring every route to be wrapped in CommandPaletteRoot.
…earch - Add commandPaletteSearch permission entity to properly control search access - Remove invalid CURATOR role references, use actual system roles (OWNER, ADMIN, SELF_SERVICE, BASE) - Implement proper booking permission checks using canSeeAllBookings flag - Restrict team member search based on custody relationships for BASE/SELF_SERVICE users - Add complete ADMIN and OWNER role definitions to permission mapping - Ensure all search results respect organization-level permission settings This addresses critical security vulnerabilities where users could access data beyond their permission level through the command palette search functionality.
…d palette - Add workspace type awareness to command palette search API - Filter out booking and team member results for personal workspaces - Hide booking/team navigation items and quick actions for personal users - Update search placeholder text to accurately reflect available search scope - Maintain proper permission checks while respecting workspace limitations Personal workspaces can now only search assets, kits, and locations, which aligns with their feature limitations and prevents confusion.
…alette - Add "Kits" navigation option accessible to all user roles - Add "Create kit" action for ADMIN/OWNER roles only - Restrict "Settings" and "Dashboard" navigation to ADMIN/OWNER roles - Restrict "Create Asset" action to ADMIN/OWNER roles only - Fix "Team" navigation to exclude BASE/SELF_SERVICE users properly - Improve bookings visibility logic to combine workspace and permission checks - Update team navigation href to point directly to users page - Enhance invite user action with proper workspace and permission filtering Role-based access now matches sidebar navigation patterns: - BASE/SELF_SERVICE: Assets, Kits, Locations, Bookings (if available) - ADMIN/OWNER: Full access including Settings, Dashboard, Team, Create actions - Personal workspaces: Exclude booking/team features regardless of role Ensures users only see command palette options they have permission to access.
…gration - Export getAssets function from asset service for direct usage - Replace getPaginatedAndFilterableAssets with direct getAssets call to avoid fetching unnecessary data - Add comprehensive search capabilities including custom fields, custodian names, QR codes, barcodes - Maintain 8-asset result limit and proper result formatting for command palette - Remove code duplication and ensure consistency with asset index search behavior Benefits: - Custom field search now works properly in command palette - More efficient queries without extra category/tag/team member data - Identical search behavior between asset index and command palette - Enhanced search includes custodian names and all related entity searches The command palette asset search now has the same powerful search capabilities as the main asset index.
There was a problem hiding this comment.
Pull Request Overview
This PR implements a command palette feature that provides users with a unified search interface to quickly find assets, kits, bookings, locations, and team members across the platform. The implementation includes keyboard shortcuts (⌘K/Ctrl+K), search stabilization to handle stale responses, and role-based permission checks.
- Adds command palette UI components with search functionality and keyboard navigation
- Implements backend API endpoint with comprehensive search across multiple entity types
- Integrates command palette buttons into the main layout and header components
Reviewed Changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds cmdk and fuse.js dependencies for command palette and fuzzy search |
| app/utils/permissions/permission.data.ts | Adds commandPaletteSearch permission entity for all roles |
| app/routes/api+/command-palette.search.ts | New API endpoint handling search across assets, kits, bookings, locations, and team members |
| app/components/shared/command.tsx | New command palette UI primitives based on cmdk library |
| app/components/layout/command-palette/ | New command palette components with context, button, and main implementation |
| app/routes/_layout+/_layout.tsx | Integrates command palette provider and button into main layout |
| app/components/layout/header/index.tsx | Adds command palette button to header navigation |
| app/modules/asset/service.server.ts | Exports getAssets function for use in command palette search |
| Various form components | Removes icon props and absolute positioned header actions for UI consistency |
Summary
Testing
https://chatgpt.com/codex/tasks/task_b_68c98bc49bf08326adbe6cf955cd3989